<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>历史rollback状态</title>
    <style type="text/css">
        table {
            margin: auto;

        }

        td, th {
            padding: 10px;
        }
    </style>
</head>
<body>

<h1 style="text-align: center"><a target="_blank" href="/admin/app01/his_rool/">历史回滚记录</a></h1>
<table border="1" style="text-align: center;">
    <tr>
        <th>ID</th>
        <th>主机</th>
        <th>主机组</th>
        <th>文件名</th>
        <th>服务类型</th>
        <th>回滚状态</th>
        <th>回滚时间</th>
        <th>删除</th>

    </tr>
    {% for i in data %}
        <tr id="{{ i.id }}">
            <td>{{ i.id }}</td>
            <td>{{ i.host }}</td>
            <td>{{ i.host_group }}</td>
            <td>{{ i.filename }}</td>
            <td>{{ i.service_type }}</td>
            {% if i.status == 2 %}
                <td>回滚成功</td>
            {% elif i.status == 0 %}
                <td>回滚失败</td>
            {% else %}
                <td>回滚中</td>
            {% endif %}
            <td>{{ i.relea_time|safe }}</td>
            <td>
                <button>删除</button>
            </td>
        </tr>
    {% endfor %}
</table>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script>
<script>
    $(document).ready(function () {
        $("button").click(function () {
            var _id = $(this).parent().parent().attr("id");
            //var select_ = $(this).parent().parent().find('select').find("option:selected").val();
            // console.log(select_);
            $("#" + _id).hide();
            //alert(_id);
            $.get("/rollback_status/", {'_id': _id}, function () {
                alert('成功删除ID为' + _id + "的记录")
            })
        });

    });
</script>
</body>
</html>